387
144
422922
43470
Interested in coding? We shall be organizing FREE workshops on "R Programming for Statistical Analysis."
— Hammed A. Akande, M.Sc. (@drhammed) May 23, 2021
If you have specific R module(s) you'd like to learn, please drop them below
This is a collaborative effort with scholars from Canada & USA
More announcements soon#RStats pic.twitter.com/JJqM2GASVf
Interested in coding? We shall be organizing FREE workshops on "R Programming for Statistical Analysis."
— Hammed A. Akande, M.Sc. (@drhammed) May 23, 2021
If you have specific R module(s) you'd like to learn, please drop them below
This is a collaborative effort with scholars from Canada & USA
More announcements soon#RStats pic.twitter.com/JJqM2GASVf
Hologram Weekend 😎#HoloLens2 #haptic https://t.co/5Kl8HlM1oH
— ⎛⎝⎠⎞ Mando Liussi ⎛⎝⎠⎞ (@mandomando) May 23, 2021
/// #AugmentedReality #AR #Rstats #Analytics #VR #MR #AI #Rstats #Reactjs #IoT #IIoT #100DaysOfCode #Linux #Serverless #DEVCommunity #flutter #DataScience #BigData #EmergingTech pic.twitter.com/JWa5JS3GsW
---
title: "#rstats Twitter Explorer"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
source_code: embed
theme:
version: 4
bootswatch: yeti
css: styles/main.css
---
```{r setup, include=FALSE}
library(flexdashboard)
library(rtweet)
library(dplyr)
library(httr)
library(lubridate)
library(echarts4r)
devtools::load_all()
rstats_tweets <- read_twitter_csv("data/rstats_tweets.csv")
count_timeseries <- rstats_tweets %>%
ts_data(by = "hours")
tweets_today <- rstats_tweets %>%
filter(created_at == today())
by_hour <- rstats_tweets %>%
group_by(hour = hour(created_at)) %>%
summarise(count = n()) %>%
ungroup()
number_of_unique_tweets <- get_unique_value(rstats_tweets, text)
number_of_unique_tweets_today <-
get_unique_value(tweets_today, text)
number_of_tweeters_today <- get_unique_value(tweets_today, user_id)
number_of_likes <- rstats_tweets %>%
pull(favorite_count) %>%
sum()
```
Home
====
Row
-----------------------------------------------------------------------
### Tweets Today
```{r}
valueBox(number_of_unique_tweets_today, icon = "fa-comment-alt", color = "plum")
```
### Tweeters Today
```{r}
valueBox(number_of_tweeters_today, icon = "fa-user", color = "peachpuff")
```
### #rstats Likes
```{r}
valueBox(number_of_likes, icon = "fa-heart", color = "palevioletred")
```
### #rstats Tweets
```{r}
valueBox(number_of_unique_tweets, icon = "fa-comments", color = "mediumorchid")
```
Row {.tabset .tabset-fade data-width=400}
-----------------------------------------------------------------------
### Tweet volume
```{r}
this_month <- floor_date(today(), "month")
count_timeseries %>%
e_charts(time) %>%
e_line(n, name = "# of tweets", smooth = TRUE, legend = FALSE) %>%
e_x_axis(
type = "time",
formatter = htmlwidgets::JS(
"function(value){
let date = new Date(value);
label = `${date.getDate()}-${(parseInt(date.getMonth()) + 1)}-${date.getFullYear()}`;
return label;
}"
)
) %>%
e_axis_labels(y = "Tweets") %>%
e_theme("westeros") %>%
e_tooltip(trigger = "axis", formatter = htmlwidgets::JS("
function(params) {
let date = new Date(params[0].value[0])
let options = { year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric'}
let title = `${date.toLocaleDateString('en-US', options=options)}`
let num = `${params[0].value[1]} tweets`
return(`${title}${num}`);
}")) %>%
e_datazoom(type = "slider") %>%
e_zoom(
dataZoomIndex = 0,
start = 70,
end = 100
) %>%
e_zoom(
dataZoomIndex = 0,
startValue = today() - 7,
endValue = today(),
btn = "weekBtn"
) %>%
e_zoom(
dataZoomIndex = 0,
startValue = this_month,
endValue = today(),
btn = "monthBtn"
) %>%
e_button(
id = "weekBtn",
position = "top",
class = "btn btn-primary btn-sm",
"This Week"
) %>%
e_button(
id = "monthBtn",
position = "top",
class = "btn btn-primary btn-sm",
"This Month"
)
```
### Tweets by Hour of Day
```{r}
by_hour %>%
e_charts(hour) %>%
e_step(count, name = "Tweets", step = "middle", legend = FALSE) %>%
e_x_axis(
min = 0,
max = 23,
) %>%
e_axis_labels(x = "Time of Day (UTC)", y = "Tweets") %>%
e_theme("westeros") %>%
e_tooltip(trigger = "axis", formatter = htmlwidgets::JS("
function(params) {
let title = `${params[0].value[0]}h`
let num = `${params[0].value[1]} tweets`
return(`${title}${num}`);
}"))
```
Row
-----------------------------------------------------------------------
### 💗 Most Liked Tweet Today {.tweet-box}
```{r}
most_liked_url <- tweets_today %>%
slice_max(favorite_count)
get_tweet_embed(most_liked_url$screen_name, most_liked_url$status_id)
```
### ✨ Most Retweeted Tweet Today {.tweet-box}
```{r}
most_retweeted <- tweets_today %>%
slice_max(retweet_count)
get_tweet_embed(most_retweeted$screen_name, most_retweeted$status_id)
```
### 🎉 Most Recent {.tweet-box}
```{r}
most_recent <- tweets_today %>%
slice_max(created_at, with_ties=FALSE)
get_tweet_embed(most_recent$screen_name, most_recent$status_id)
```
Data
====